﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace medder
{
    class GridHelper
    {
        public static void CreateColumnsUsers(DataGridView bookView)
        {
            bookView.Columns.Add("Passport", "Паспорт");
            bookView.Columns["Passport"].ReadOnly = true;
            bookView.Columns["Passport"].Width = 80;

            bookView.Columns.Add("Login", "Логин");
            bookView.Columns["Login"].ReadOnly = true;

            bookView.Columns.Add("Password", "Пароль");
            bookView.Columns["Password"].ReadOnly = true;

            bookView.Columns.Add("Name", "Имя");
            bookView.Columns["Name"].ReadOnly = true;

            bookView.Columns.Add("Surname", "Фамилия");
            bookView.Columns["Surname"].ReadOnly = true;

            bookView.Columns.Add("Patronymic", "Отчество");
            bookView.Columns["Patronymic"].ReadOnly = true;

            bookView.Columns.Add("CodeActivate", "Код активации");
            bookView.Columns.Add("IsActive", "Статус");
        }

        public static void CreateColumnsCommon(DataGridView bookView)
        {
            bookView.Columns.Add("Passport", "Паспорт");
            bookView.Columns["Passport"].ReadOnly = true;
            bookView.Columns["Passport"].Width = 80;

            bookView.Columns.Add("Name", "Имя");
            bookView.Columns["Name"].ReadOnly = true;

            bookView.Columns.Add("Surname", "Фамилия");
            bookView.Columns["Surname"].ReadOnly = true;

            bookView.Columns.Add("Patronymic", "Отчество");
            bookView.Columns["Patronymic"].ReadOnly = true;
        }

        public static string PresentPassport(string passport)
        {
            string newPassport = passport.Substring(0,2) + " " + passport[2] + passport[3] + " " + passport.Substring(4);
            return newPassport;
        }

        public static string SavePassport(string passport)
        {
            string newPassport = passport.Replace(" ", string.Empty);
            return newPassport;
        }
    }
}
